﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    x:Class="Microsoft.Telco.Controls.CountryPicker"
    x:Name="CountryPickerUserControl"
    d:DesignWidth="640"
    d:DesignHeight="480">
    <Grid
        x:Name="LayoutRoot">
        <Border
            BorderBrush="#FFC2BCBC"
            x:Name="bdrCountryPicker"
            BorderThickness="1"
            HorizontalAlignment="Left"
            MouseLeftButtonDown="bdrCountryPicker_MouseLeftButtonDown"
            VerticalAlignment="Top">
            <Border.Background>
                <LinearGradientBrush
                    EndPoint="0.5,1"
                    StartPoint="0.5,0">
                    <GradientStop
                        Color="#FFCFCFCF"
                        Offset="0.671" />
                    <GradientStop
                        Color="White"
                        Offset="0.292" />
                    <GradientStop
                        Color="#FFFBFBFB"
                        Offset="0.465" />
                </LinearGradientBrush>
            </Border.Background>
            <StackPanel
                Orientation="Horizontal">
                <Image
                    x:Name="countryImage"
                    Margin="2"></Image>
                <Path
                    Data="M44.395828,0 L44.395828,30.112816"
                    Fill="#FFCCCCCC"
                    HorizontalAlignment="Right"
                    Stretch="Fill"
                    Stroke="#FFDFDFDF"
                    UseLayoutRounding="False"
                    Width="1">
                    <Path.Effect>
                        <DropShadowEffect
                            BlurRadius="0"
                            ShadowDepth="1"
                            Color="White"
                            Direction="0" />
                    </Path.Effect>
                </Path>
                <Path
                    Data="M212.91145,48.984737 L218.16191,48.984749 L215.66211,51.976151 z"
                    Height="4"
                    Stretch="Fill"
                    Width="8"
                    HorizontalAlignment="Center"
                    UseLayoutRounding="False"
                    VerticalAlignment="Center"
                    Margin="2,0,0,0">
                    <Path.Effect>
                        <DropShadowEffect
                            BlurRadius="0"
                            ShadowDepth="1"
                            Color="White" />
                    </Path.Effect>
                    <Path.Fill>
                        <LinearGradientBrush
                            EndPoint="0.854,0.854"
                            StartPoint="0.146,0.146">
                            <GradientStop
                                Color="#FF525252"
                                Offset="1" />
                            <GradientStop
                                Color="#FF676565" />
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </StackPanel>
        </Border>
        <Popup
            x:Name="popupCountries">
            <ListBox
                x:Name="listCountries"
                HorizontalAlignment="Left"
                Height="300"
                Width="270"
                VerticalAlignment="Center"
                SelectionChanged="listCountries_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid
                            Background="{Binding Backgound, ElementName=CountryPickerUserControl}"
                            HorizontalAlignment="Stretch"
                            Width="240">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    Width="Auto" />
                                <ColumnDefinition
                                    Width="*" />
                                <ColumnDefinition
                                    Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Image
                                Grid.Column="0"
                                HorizontalAlignment="Left"
                                Source="{Binding ImageUrl}"
                                Stretch="Fill"
                                VerticalAlignment="Center" />
                            <TextBlock
                                Grid.Column="1"
                                TextWrapping="Wrap"
                                Text="{Binding Name}"
                                VerticalAlignment="Center"
                                Margin="3,0,0,0"
                                Foreground="{Binding Foreground, ElementName=CountryPickerUserControl}"
                                FontSize="{Binding FontSize, ElementName=CountryPickerUserControl}"
                                FontFamily="{Binding FontFamily, ElementName=CountryPickerUserControl}" />
                            <TextBlock
                                Grid.Column="2"
                                TextWrapping="Wrap"
                                Text="{Binding Code}"
                                VerticalAlignment="Center"
                                Foreground="{Binding Foreground, ElementName=CountryPickerUserControl}"
                                FontSize="{Binding FontSize, ElementName=CountryPickerUserControl}"
                                FontFamily="{Binding Family, ElementName=CountryPickerUserControl}" />
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Popup>
    </Grid>
</UserControl>